<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>蓝科客户管理系统&nbsp;-&nbsp;完全开源、免费的CRM管理系统！</title>
    <link rel="shortcut icon" type="image/x-icon" href="css/favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="easyui/themes/icon.css">
    <script type="text/javascript" src="easyui/jquery.min.js"></script>
    <script type="text/javascript" src="easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="easyui/plugin/portal/jquery.portal.js"></script>
    <script type="text/javascript" src="easyui/plugin/easyui.resize.js"></script>
    <script type="text/javascript" src="easyui/plugin/baseloading.js"></script>
    <link rel="stylesheet" type="text/css" href="easyui/plugin/portal/portal.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script type="text/javascript" src="easyui/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" type="text/css" href="easyui/plugin/texteditor/texteditor.css">
    <script type="text/javascript" src="easyui/plugin/texteditor/jquery.texteditor.js"></script>
</head>
<body id="layout_body" class="easyui-layout">
<div data-options="region:'west',split:true,collapsible:false" style="width:180px;">
    <table id="admin_info">
        <tr>
            <td rowspan="2"><img id="myAvator" src="<?php
                $userinfo = $this->getLastUserInfo();
                echo $userinfo['userimage'] ?>"
                                 style="width: 50px;height: 50px;"/></td>
            <td><?php
                    echo Yii::app()->user->realname;
                    ?></td>
        </tr>
        <tr>
            <td>
                <span class="left">
                    <a href="y.php?r=site/loginout">退出</a>
                </span>
                <?php
                if (Yii::app()->user->checkAccess('personalconfig_config')) {
                    ?>
                    <span class="right">
                    <a href="javascript:loadWin('个人设置','y.php?r=site/config')">配置</a>
                </span>
                    <?php
                }
                ?>
            </td>
        </tr>
    </table>
    <div class="easyui-accordion" data-options="fit:false,animate:false">
        <?php
        if (Yii::app()->user->checkAccess('workspace')) {
            ?>
            <div title="工作台" class="menu_accordion" >
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('workspace_site')) {
                        ?>
                        <li class="before"><a href="javascript:showTab('控制台','y.php?r=site/index')">控制台</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('workspace_announcements')) {
                        ?>
                        <li class="before"><a href="javascript:showTab('公告','y.php?r=announcements/index')">公告</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('workspace_dailylogs')) {
                        ?>
                        <li><a href="javascript:showTab('日报','y.php?r=dailylogs/index')">日报</a></li>
                        <?php
                    }
                    ?>
                    <!--                <li><a href="javascript:showTab('周报','y.php?r=weeklylogs/index')">周报</a></li>-->
                    <!--                <li><a href="javascript:showTab('月报','y.php?r=monthlylogs/index')">月报</a></li>-->
                    <!--                <li><a href="javascript:showTab('工作流','y.php?r=myworkflow/index')">工作流</a></li>-->
                </ul>
            </div>
            <?php
        }
        if (Yii::app()->user->checkAccess('campaigns')) {
            ?>
            <div title="营销" class="menu_accordion" >
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('campaigns_module')) {
                        ?>
                        <li><a href="javascript:showTab('营销活动','y.php?r=campaigns/index')">营销活动</a></li>
                        <?php
                    }
                    ?>
<!--                    <li><a href="javascript:showTab('营销群','y.php?r=marketinggroup/index')">营销群</a></li>-->
                </ul>
            </div>
            <?php
        }
        if (Yii::app()->user->checkAccess('customer')) {
            ?>
            <div title="客户" class="menu_accordion"  >
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('customer_module')) {
                        ?>
                        <li><a href="javascript:showTab('客户','y.php?r=customer/index')">客户</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('contacter_module')) {
                        ?>
                        <li><a href="javascript:showTab('联系人','y.php?r=contacter/index')">联系人</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('contactlog_module')) {
                        ?>
                        <li><a href="javascript:showTab('联系记录','y.php?r=contactlog/index')">联系记录</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('memdays_module')) {
                        ?>
                        <li><a href="javascript:showTab('纪念日','y.php?r=memdays/index')">纪念日</a></li>
                        <?php
                    }
                    ?>
                </ul>
            </div>
            <?php
        }
//        if (Yii::app()->user->checkAccess('product')) {
//            ?>
<!--            <div title="产品" class="menu_accordion" style="padding:8px;">-->
<!--                <ul>-->
<!--                    --><?php
//                    if (Yii::app()->user->checkAccess('product_module')) {
//                        ?>
<!--                        <li><a href="javascript:showTab('产品','y.php?r=product/index')">产品</a></li>-->
<!--                        --><?php
//                    }
//                    if (Yii::app()->user->checkAccess('productcategory_module')) {
//                        ?>
<!--                        <li><a href="javascript:showTab('产品分类','y.php?r=productcategory/index')">产品分类</a></li>-->
<!--                        --><?php
//                    }
//                    ?>
<!--                </ul>-->
<!--            </div>-->
<!--            --><?php
//        }
        if (Yii::app()->user->checkAccess('sale')) {
            ?>
            <div title="销售" class="menu_accordion"  >
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('potentials_module')) {
                        ?>
                        <li><a href="javascript:showTab('销售机会','y.php?r=potentials/index')">销售机会</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('quotes_module')) {
                        ?>
                        <li><a href="javascript:showTab('报价单','y.php?r=quotes/index')">报价单</a></li>
                        <?php
                    }
                    ?>

                                    <li><a href="javascript:showTab('竞争对手','y.php?r=competitor/index')">竞争对手</a></li>
<!--                                    <li><a href="javascript:showTab('合同订单','y.php?r=salesorder/index')">合同订单</a></li>-->
<!--                                    <li><a href="javascript:showTab('发货单','y.php?r=invoice/index')">发货单</a></li>-->
<!--                                    <li><a href="javascript:showTab('销售退货单','y.php?r=tuihuo/index')">销售退货单</a></li>-->
                </ul>
            </div>
            <?php
        }
        ?>


        <!--        <div title="采购" class="menu_accordion" style="padding:8px;">-->
        <!--            <ul>-->
        <!--                <li><a href="javascript:showTab('采购申请','y.php?r=caigous/index')">采购申请</a></li>-->
        <!--                <li><a href="javascript:showTab('进货单','y.php?r=purchasedrder/index')">进货单</a></li>-->
        <!--                <li><a href="javascript:showTab('供应商','y.php?r=vendors/index')">供应商</a></li>-->
        <!--                <li><a href="javascript:showTab('供应商联系人','y.php?r=vcontacts/index')">供应商联系人</a></li>-->
        <!--                <li><a href="javascript:showTab('供应商联系记录','y.php?r=vnotes/index')">供应商联系记录</a></li>-->
        <!--                <li><a href="javascript:showTab('采购退货单','y.php?r=caigoutuihuos/index')">采购退货单</a></li>-->
        <!--            </ul>-->
        <!--        </div>-->
        <?php
        if (Yii::app()->user->checkAccess('aftersale')) {
            ?>
            <div title="售后" class="menu_accordion"  >
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('accountrecordss_module')) {
                        ?>
                        <li><a href="javascript:showTab('客户服务','y.php?r=accountrecordss/index')">客户服务</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('complaints_module')) {
                        ?>
                        <li><a href="javascript:showTab('客户投诉','y.php?r=complaints/index')">客户投诉</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('faq_module')) {
                        ?>
                        <li><a href="javascript:showTab('常见问题','y.php?r=faq/index')">常见问题</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('faqcategory_module')) {
                        ?>
                        <li><a href="javascript:showTab('常见问题分类','y.php?r=faqcategory/index')">常见问题分类</a></li>
                        <?php
                    }
                    ?>
                </ul>
            </div>
            <?php
        }
        ?>
        <!--        <div title="库存" class="menu_accordion"  >-->
        <!--            <ul>-->
        <!--                <li><a href="javascript:showTab('入库单','y.php?r=warehousesorder/index')">入库单</a></li>-->
        <!--                <li><a href="javascript:showTab('出库单','y.php?r=deliverys/index')">出库单</a></li>-->
        <!--                <li><a href="javascript:showTab('盘点','y.php?r=checks/index')">盘点</a></li>-->
        <!--                <li><a href="javascript:showTab('库存余额','y.php?r=balances/index')">库存余额</a></li>-->
        <!--                <li><a href="javascript:showTab('初始化库存','y.php?r=prdtnums/index')">初始化库存</a></li>-->
        <!--                <li><a href="javascript:showTab('库间调拨','y.php?r=warehousetransfers/index')">库间调拨</a></li>-->
        <!--                <li><a href="javascript:showTab('库存流水账','y.php?r=wareledgers/index')">库存流水账</a></li>-->
        <!--            </ul>-->
        <!--        </div>-->
        <!--        <div title="财务" class="menu_accordion" style="padding:8px;">-->
        <!--            <ul>-->
        <!--                <li><a href="javascript:showTab('应收款','y.php?r=gathers/index')">应收款</a></li>-->
        <!--                <li><a href="javascript:showTab('应付款','y.php?r=charges/index')">应付款</a></li>-->
        <!--                <li><a href="javascript:showTab('付款单','y.php?r=chargesrecords/index')">付款单</a></li>-->
        <!--                <li><a href="javascript:showTab('往来账','y.php?r=forthamounts/index')">往来账</a></li>-->
        <!--                <li><a href="javascript:showTab('进项发票','y.php?r=pobills/index')">进项发票</a></li>-->
        <!--                <li><a href="javascript:showTab('期初余额','y.php?r=openingbalancess/index')">期初余额</a></li>-->
        <!--                <li><a href="javascript:showTab('费用报销','y.php?r=expenses/index')">费用报销</a></li>-->
        <!--                <li><a href="javascript:showTab('发票管理','y.php?r=billings/index')">发票管理</a></li>-->
        <!--            </ul>-->
        <!--        </div>-->
        <?php
        if (Yii::app()->user->checkAccess('sysconfig')) {
            ?>
            <div title="系统设置" class="menu_accordion"  >
                <ul>
                    <?php
                    if (Yii::app()->user->checkAccess('sysconfig_user_module')) {
                        ?>
                        <li><a href="javascript:showTab('系统用户','y.php?r=settings/user/index')">系统用户</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_role_module')) {
                        ?>
                        <li><a href="javascript:showTab('角色权限','y.php?r=settings/role/index')">角色权限</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_picklist_module')) {
                        ?>
                        <li><a href="javascript:showTab('数据字典','y.php?r=settings/picklist/index')">数据字典</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_messager_module')) {
                        ?>
                        <li><a href="javascript:showTab('短信平台','y.php?r=settings/messager/index')">短信平台</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_messagetemplate_module')) {
                        ?>
                        <li><a href="javascript:showTab('短信模板','y.php?r=settings/messagetemplate/index')">短信模板</a></li>
                        <?php
                    }
                    if (Yii::app()->user->checkAccess('sysconfig_loginhistory_module')) {
                        ?>
                        <li><a href="javascript:showTab('登入历史','y.php?r=settings/loginhistory/index')">登入历史</a></li>
                        <?php
                    }
                    ?>


<!--                    <li><a href="javascript:showTab('系统配置','y.php?r=settings/system/index')">系统配置</a></li>-->

<!--                    <li><a href="javascript:showTab('审批流程','y.php?r=settings/workflow/index')">审批流程</a></li>-->
<!--                    <li><a href="javascript:showTab('流程模块','y.php?r=settings/workflowmodule/index')">流程模块</a></li>-->
<!--                    <li><a href="javascript:showTab('多仓库管理','y.php?r=settings/warehouse/index')">多仓库管理</a></li>-->
                </ul>
            </div>
            <?php
        }
        ?>
    </div>
</div>
<div data-options="region:'center',border:false">
    <div id="win_main" class="easyui-window" title=""
         data-options="modal:true,closed:true" style="padding: 10px;">
    </div>
    <div id="win_main_2" class="easyui-window" title=""
         data-options="modal:true,closed:true">
    </div>
    <div class="easyui-tabs" data-options="fit:'true'" id="sys_tab">

    </div>
</div>
<script>
    $(function () {
        $('#sys_tab').tabs('add', {
            'title': '控制台',
            'href': 'y.php?r=site/index'
        });
        $('#layout_body').layout('hidden', 'east');
//        $('#layout_body').layout('unsplit','east');
        $(".menu_accordion").find("ul li").bind("click", function () {
            //将其他的样式背景的active处理掉，然后在当前的li上面加上active
            $(".menu_accordion").find("ul li").removeClass("checkactive");
            $(this).closest("li").addClass("checkactive");
        });
    });
    function showTab(title, url) {
        var tab = $('#sys_tab').tabs('getTab', title);
        if (tab != null) {
            $('#sys_tab').tabs('select', title);
        } else {
            $('#sys_tab').tabs('add', {
                'title': title,
                'href': url,
                'closable': true
            });
            $('#layout_body').layout('hidden', 'east');
        }
    }
    function layoutresize() {
        $("body").onresize(function () {
            $('#layout_body').layout("resize");
        });
    }
    function loadWin(title, url) {
        $('#win_main').window({
            width: $(window).width() * 0.618,
            height: $(window).height() * 0.618,
            modal: true,
            title: title,
            href: url,
            collapsible: false,
            minimizable: false,
            maximizable: false
        });
        $('#win_main').window('center');
        $('#win_main').window('open');
    }
    function loadWin2(title, url) {
        $('#win_main_2').window({
            width: $(window).width() * 0.618 * 0.618,
            height: $(window).height() * 0.618 * 0.618,
            modal: true,
            title: title,
            href: url,
            collapsible: false,
            minimizable: false,
            maximizable: false
        });
        $('#win_main_2').window('center');
        $('#win_main_2').window('open');
    }
</script>
</body>
</html>
